Skip to main content

SetBasedOn

Specifies the reference to the parent style which this style inherits from in the style hierarchy.

Syntax

expression.SetBasedOn(oStyle);

expression - A variable that represents a ApiStyle class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oStyleRequiredApiStyleThe parent style which the style inherits properties from.

Returns

This method doesn't return any data.

Example

This example specifies the reference to the parent style which this style inherits from in the style hierarchy.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(2, 2);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);